//
//  ViewController.m
//  collectionView
//
//  Created by 小白 on 16/3/9.
//  Copyright © 2016年 小白. All rights reserved.
//

#import "ViewController.h"
#import "CollectionViewController.h"
@interface ViewController ()<CollectionViewControllerDelegate>
@property (nonatomic,strong) UILabel *labelName;
@property (nonatomic,strong) UIImageView *imgView;
@property (nonatomic,strong) UIButton *Btn;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    UILabel *labelTop = [[UILabel alloc]initWithFrame:CGRectMake(120, 50, 100, 30)];
    labelTop.text = @"China";
    self.labelName = labelTop;
    [self.view addSubview:labelTop];
    UIImageView *img = [[UIImageView alloc]initWithFrame:CGRectMake(60, 100, 200    , 100)];
    self.imgView = img;
    [self.view addSubview:img];
    UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(120, 300, 100, 40)];
    [btn setTitle:@"Select Contry" forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(btnPress) forControlEvents:UIControlEventTouchUpInside];
    self.Btn = btn;
    [self.view addSubview:btn];
    img.image = [UIImage imageNamed:@"China"];
    
}
-(void)addImageAndLabelText:(NSString *)image AndLabel:(NSString *)label{
    self.imgView.image = [UIImage imageNamed:image];
    self.labelName.text = label;

}
-(void)btnPress {
    UICollectionViewFlowLayout *flow = [[UICollectionViewFlowLayout alloc]init];
    CollectionViewController *VC = [[CollectionViewController alloc]initWithCollectionViewLayout:flow];
    [self presentViewController:VC animated:YES completion:nil];
    VC.Delegate = self;
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
